app.controller('navUploadCtrl', ['$element', '$scope', 'imagePrefix', 'imageAddress', 'uploadAddress', 'signature', function($element, $scope, imagePrefix, imageAddress, uploadAddress, signature) {
    var data = angular.copy($scope.ngDialogData, {});
    $scope.title = data.title;
    $scope.items = data.data;
    $scope.imageObject = {};
    $scope.repeatFinish = function() {
        angular.element(".nav-upload-panel").each(function(i, I) {
            var defaultImage = $(I).data('defaultImage');
            var field = $(I).data('defaultImage');
            $(I).uploadImage({
                url: uploadAddress,
                idCard: new Date().getTime().toString(),
                defaultImage: defaultImage,
                preAddress: imagePrefix,
                data: signature.run('9999', {}),
                fileImage: null,
                onchange: function($el) {
                    var list = $($el).find(".uploadFileAddress"),
                        string = [];
                    var field = $($el).parents(".nav-upload-panel").data("field");
                    list.each(function(key, value) {
                        if (value.value !== "") {
                            string.push(value.value);
                        }
                    });
                    $scope.imageObject[field] = string.join(",");
                }
            });
        })
    }
    $scope.makeSureConfirm = function() {
        $scope.confirm($scope.imageObject);
    }
}]);